@extends('admin.base')
@section('css')
<link href="{{asset('/css/fileinput.min.css')}}" rel="stylesheet" />
<style>div select {
	min-width: 4em;
}</style>
@endsection
@section('title','Create Article')
@section('content')
<div class="col-md-12">
	<form action="{{ URL('siteadmin/article')}}" method="post" id="article" enctype="multipart/form-data">
		<input type="hidden" name="_method" value="POST" />
		<input type="hidden" name="_token" value="{{ csrf_token()}}" />
		<div class="form-group row" >
			<div class="row">
			<div class="col-md-3">
				<label class="control-label">Title</label>
				<input type="text" class="form-control" maxlength="50" name="title" placeholder="Title..." required/>
			</div>			
			<div class="col-md-3">
				<label class="control-label">Category</label>
				<select name="category" class="form-control">
					@foreach($category as $cate)
					<option value="{{ $cate->category}}">
						{{$cate->category}}
					</option>
					@endforeach
				</select>
			</div>
			</div><div class="row">
			<div class="form-group col-md-6">
				<label class="control-label">Cover</label>
				<input type="file" id="cover" name="cover" class="file-loading" style="display: table-cell;" />
			</div>
			</div>
		</div>
			
			
		
		<div class="form-group row">
			<textarea type="text" class="form-control" name='articleContent' id="textareaArticle" rows="15">
				Content...
			</textarea>			

		</div>
		<div class="form-group pull-right">
			<button type="submit" class="btn btn-success">
				Save
			</button>
			<a href="{{ URL('siteadmin/article')}}" class="btn btn-danger">
				Cancel
			</a>
		</div>
	</form>
</div>
@endsection
@section('js')
<script src="{{ asset('/ckeditor/ckeditor.js')}}" type="text/javascript"></script>
<script src="{{asset('/js/fileinput.min.js')}}" type="text/javascript"></script>
<script>CKEDITOR.replace('textareaArticle');
CKEDITOR.config.height = 200;
$(document).on('ready', function() {
	$("#cover").fileinput({
		allowedFileTypes: ["image"],
		showRemove: true,
		showUpload: true,
		uploadAsync: false,
	});
});</script>
@endsection
